﻿<UserControl x:Class="SMS.Views.AppHealth.LoginHistory"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="600"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             xmlns:my="clr-namespace:SMS.Controls;assembly=SMS.Controls">
    <Border BorderBrush="Black"
            BorderThickness="1">
        <Grid x:Name="LayoutRoot" Margin="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="10" />
                <RowDefinition Height="*" />
                <RowDefinition Height="30" />
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="From Date: "
                           VerticalAlignment="Center" />
                <sdk:DatePicker Width="150"
                                SelectedDate="{Binding Path=FromDate, Mode=TwoWay}"
                                VerticalAlignment="Center" />
                <TextBlock Text="To Date: "
                           VerticalAlignment="Center" />
                <sdk:DatePicker Width="150"
                                SelectedDate="{Binding Path=ToDate, Mode=TwoWay}"
                                VerticalAlignment="Center" />
                <Button Content="Show"
                        Command="{Binding Path=ShowCommand}"
                        CommandParameter="Login"
                        VerticalAlignment="Center" />

                <TextBlock Text="Page Size: " />
                <TextBox Width="150"
                         Text="{Binding Path=PageSize, Mode=TwoWay}" />
            </StackPanel>
            <Rectangle Grid.Row="1"
                       Fill="Black"
                       Height="1" />
            <Grid Grid.Row="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <sdk:DataGrid AutoGenerateColumns="False"
                              HorizontalAlignment="Stretch"
                              ItemsSource="{Binding Path=PagedLoginHistory}"
                              VerticalAlignment="Top">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn Header="User"
                                                Width="100"
                                                Binding="{Binding Path=UserName}" />
                        <sdk:DataGridTextColumn Header="Login Time"
                                                Width="150"
                                                Binding="{Binding Path=LoginTimeString}" />
                        <sdk:DataGridTextColumn Header="Logout Time"
                                                Width="150"
                                                Binding="{Binding Path=LogoutTimeString}" />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
                <Grid Grid.Row="1">
                    <sdk:AutoCompleteBox Text="{Binding Path=QuickSearch, Mode=TwoWay, FallbackValue=Quick  Search}"
                                         Width="100"
                                         VerticalAlignment="Center"
                                         HorizontalAlignment="Left" />

                    <sdk:DataPager HorizontalAlignment="Right"
                                   Source="{Binding Path=PagedLoginHistory}" />
                </Grid>
            </Grid>
            <Grid Grid.Row="3">
                <my:ErrorControl HorizontalAlignment="Left"
                                 Name="errorControl1"
                                 VerticalAlignment="Top" />
            </Grid>
        </Grid>
    </Border>
</UserControl>
